package week2;


public class Ex14 {
    public static void main(String[] args) {
        long count, maxcount = 0L, maxnum = 0L;
        for (long i = 2L; i <= 1000000L; i ++){
            count = 1L;
            long t = i;
            while (t != 1){
                if (t % 2 == 0){
                    t /= 2;
                } else{
                    t = 3 * t + 1;
                }
                count++;
            }
            if (count > maxcount){
                maxcount = count;
                maxnum = i;
            }
        }
        System.out.println(maxnum);
    }
}
